<?php
//header("Content-Type: text/html; charset=ISO-8859-1",true);
if(!isset($_SESSION))session_start();
if(!isset($_SESSION['usuario'])){
	session_destroy();
	header("location:index.php"); exit;
	}

include 'classes/Crud.php';
$con = new Crud();
$con->connect();
$setor = $_POST['setor'];
$past = $_POST['past'];
$ss=mysql_real_escape_string($_GET['q']);
var_dump($setor, $past, "pasta=".$_GET['q'], "setor=".$_GET['p']);
/*
 * $op = mysql_query("SELECT cat.nome from categorias cat inner JOIN categorias ca on cat.heranca = ca.id
 where LOCATE('$ss', ca.nome)>0 order by nome asc ") or die (mysql_error());
 * 
 */
$op = mysql_query("select cont.nomec AS arquivo from categorias cat INNER JOIN categorias
ca on ca.heranca = cat.id INNER JOIN conteudo cont ON ca.id = cont.fk_categorias
where cat.nome='$setor' and ca.nome='$past'") or die (mysql_error());
while ($linha = mysql_fetch_array($op)){
$nome = $linha['arquivo'];
$html = preg_replace("/(" . $ss . ")/i", "<span style=\"font-weight:bold\">\$1</span>", $nome);
echo "<option>Novo</option>";
echo "<option>$html</option>";
echo $linha[arquivo];

}


?>
